This tutorial gives you an idea about how to use the WMC-SDK in Universal Windows Platform (UWP) apps.
Setup the environment on Windows 10 and XBOX
- Download Visual Studio 2019
- Install the required components Development Environment Setup
- Once the
Visual Studio
installation complete, open the Visual Studio
and create a new Universal Windows
project.
- Put your Xbox One into development mode. This guide was useful: devkit-activation
- Run/debug the newly created app using
Local Machine
or Remote Machine
.
Modification in Sample Project
- Open the
MainPage.xmal
from newly created project and add a WebView from the toolbox.
- On the
Page_Load
method, add the following which will load the remote player as well as enable script notification
WebView.Navigate(new Uri("https://wmc.mr.tv3cloud.com/master/latest/RefApp/index.html?t=" + DateTime.Now.Ticks));`
WebView.ScriptNotify += this.WebView_ScriptNotify;
ScriptNotify
will give you all the data which WMC-SDK send via window.external.notify
- App user can send custom command to the SDK via
InvokeScriptAsync
WebView.InvokeScriptAsync("CommandName", "Command Arguments");
White-listing tv3cloud.com in Package.appxmanifest
You will need to add https://*.*.tv3cloud.com/
to the application contentUri rules so that you can communicate with the player and it will need to have WindowsRuntimeAccess="all".
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="MyApp.App">
<uap:VisualElements Mode code inhere />
<uap:ApplicationContentUriRules>
<uap:Rule Match="https://*.*.tv3cloud.com/" Type="include" WindowsRuntimeAccess="all" />
</uap:ApplicationContentUriRules>
</Application>
</Applications>
Screenshot:
Desktop Simulator(Local Machine)
XBOX (Remote Machine)
WMC-SDK Console access from UWP application
Following code snippet can help user to access javascript console.log from UWP app using window.external.notify
...
(function () {
if (typeof console != "undefined")
if (typeof console.log != 'undefined')
console.olog = console.log;
else
console.olog = function () { };
console.log = function (message) {
console.olog(message);
if (typeof (window.external) !== 'undefined' && ('notify' in window.external)) {
window.external.notify(message);
}
};
console.trace = console.error = console.debug = console.info = console.log
})();
Player Document and RefApp Link
- Details player document is available here (WMC-SDK Documentation)
- RefApp player for XBOX is avaliable here ((WMC-XBOX)[https://wmc.mr.tv3cloud.com/master/latest/RefApp])
Player domain whitelist
SDK needs to whitelist the domain. Normally it's comes with the format ms-appx-web://*
. If you create a new application, please share the origin/domain information, we will add and map with your application.
Use PlayReady DRM on Xbox One
To use PlayReady DRM in a UWP app on Xbox One, you will first need to register your Partner Center account that you're using to publish the app for authorization to use PlayReady.
Once you receive authorization, you'll need to add an additional <DeviceCapability>
to the app manifest. You'll have to add this manually because there is currently no setting available in the App Manifest Designer. Follow these steps to configure it:
- With the project open in Visual Studio, open the Solution Explorer and right-click Package.appxmanifest.
- Select Open With..., choose XML (Text) Editor, and click OK.
- Between the tags, add the following :
<DeviceCapability Name="6a7e5907-885c-4bcb-b40a-073c067bd3d5" />
Save the file.
Finally, there is one last consideration when using PlayReady on Xbox One: on development kits, there is an SL150 limit (that is, they can't play SL2000 or SL3000 content). Retail devices are able to play content with higher security levels, but to test your app on a dev kit, you'll need to use SL150 content.